#include "logs/GlobalAPI.hpp"
#include <vector>
#include <fstream>
using std::unique_ptr;
using std::vector;
using namespace mylog;

void test_log()
{
    // Logger::ptr loger = LoggerManager::GetInstance().GetLogger("test");
    LOGD("%s", "这是一条测试消息");
    LOGW("%s", "这是一条测试消息");
    LOGF(__FILE__, __LINE__, "%s", "这是一条测试消息");
    LOGI(__FILE__, __LINE__, "%s", "这是一条测试消息");
    LOGE(__FILE__, __LINE__, "%s", "这是一条测试消息");
    for (int i = 0; i < 50000; i++)
    {
        LOGF(__FILE__, __LINE__, "%s %d", "这是一条测试消息", i);
    }
}

int main()
{
    unique_ptr<Logger::Builder> builder(new GlobalLoggerBuilder);
    builder->BuildFormatter();
    builder->BuildLoggerLevel(LogLevel::Level::DEBUG);
    builder->BuildLoggerName("test");
    builder->BuildSink<StdoutSink>();
    builder->BuildSink<FileSink>("./logfile/test.txt");
    builder->BuildSink<RollBySizeSink>("./logfile/test-", 1024);
    builder->Build();
    test_log();
    return 0;
}